<script type="text/javascript">
$(document).ready(function(){


    $.formValidator.initConfig({
        formid:"pointform",
        validatorgroup:"pointform",
        autotip:true
    });

    $("#pointcode").formValidator({
        validatorgroup:"pointform",
        onshow:"请输入赠送券卡号",
        onfocus:"请输入{$Think.config.sysconfig.pointb_name}的帐号",
        oncorrect:"请确认充值信息"
    }).inputValidator({
        min:1,
        empty:{leftempty:false,rightempty:false,emptyerror:"您输入的赠送券卡号有误"},
        onerror:"请输入正确的赠送券卡号"
    });
    $("#cardsn").formValidator({
        validatorgroup:"pointform",
        onshow:"请输入赠送券的卡密码",
        onfocus:"请输入赠送券的卡密码",
        oncorrect:"请确认充值信息"
    }).inputValidator({
        min:1,
        empty:{leftempty:false,rightempty:false,emptyerror:"您输入的卡密码有误"},
        onerror:"请输入正确的卡密码"
    });

});


//发送用户充值{$Think.config.sysconfig.pointb_name}的操作
function send_pointform(){
    var pass=$.formValidator.pageIsValid('pointform');
    var card = $("#pointcode").attr("value");
    var cardsn = $("#cardsn").attr("value");
    if(pass){
        $.post(APP+'/Member/chargeCard',
        {
        "card":card,
        "cardsn":cardsn
        },
        function(data,success){
            //0;//充值失败
            //1;//充值成功
            //2;//已被使用
            //3;//超出有效期
            //4;//超出充值次数
            if(data==1){
                tlsalert("赠券充值成功!");
                //mbsimajax(APP+'/Member/mb_count/','mbAjaxShow');
            }else if(data==0){
                tlsalert("赠券充值未成功,请检查卡号与密码是否输入正确!");
            }else if(data==2){
                tlsalert("此券已被使用,充值失败!");
            }else if(data==3){
                tlsalert("此券已超出使用有效期,充值失败!");
            }else if(data==4){
                tlsalert("充值次数已达最高限制,充值失败!");
            }else if(data==5){
                tlsalert("为了您的账户安全，请先进行\"帐户安全认证\"!");
            }
        }
        );
    }else{
        tlsalert('输入格式有误,请检查!');
    }
}

function tlsalert(txt){
    addDialogbox("#tlsalertbox","{$Think.config.sysconfig.pointb_name}充值信息",10001,302);
    msg=txt+'<br>'+
    '<div class="tc">'+
    '<span class="button">'+
    '<span class="first-child">'+
    '<button type="button" class="f12" onclick="removeDialogbox(\'#tlsalertbox\');">我知道了,返回</button>'+
    '</span>'+
    '</span>'+
    '</div>';
    $("#tlsalertbox .dialogboxContent").html(msg);
}

</script>



<div class="container regWrap">
    <div class="tabview"><h2 class="title fl">点券激活</h2></div>
    <form id="pointform">
    <div class="content" style="display:block;">
        <p class="inputWrap">请输入您获得的充值卡号和密码，逾期失效。</p>
        <p class="inputWrap">
            <label for="pointcode">卡号:</label>
            <input class="input" name="pointcode" id="pointcode" style="width:220px;" />
            <span id="pointcodeTip"></span>
        </p>
        <p class="inputWrap">
            <label for="cardsn">密码:</label>
            <input class="input" name="cardsn" id="cardsn" style="width:220px;" />
            <span id="cardsnTip"></span>
        </p>
        <p>
            <span class="button">
                <span class="first-child">
                    <button type="button" class="strong" onclick="send_pointform();">确定充值</button>
                </span>
            </span>
        </p>

    </div>
    </form>
</div>